# -*- coding: cp936 -*-
import Image
import os.path

for f in os.listdir('source'):
    src = Image.open('source/'+f)
    src=src.convert("L") 
    dst_path = str( 'source/' + f )
    src.save( dst_path )

# crop the result img 8 edge
for f in os.listdir('result'):
    src = Image.open('result/'+f)
    src = src.crop((8,8,src.size[0]-8,src.size[1]-8))
    dst_path = str( 'result/' + f )
    src.save( dst_path )
    